﻿<Window x:Class="Visualizer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:HelixToolkit="clr-namespace:HelixToolkit.Wpf;assembly=HelixToolkit.Wpf"
        xmlns:local="clr-namespace:Visualizer"
        Title="Visualizer" Height="720" Width="1028">
    <Window.Resources>
        <Style x:Key="myButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="FontStyle" Value="Normal" />
            <Setter Property="BorderBrush" Value="Transparent" />
        </Style>
    </Window.Resources>
    <Grid x:Name="Container" Background="DarkGray">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Column="0" Orientation="Vertical" Background="Gray">
            <Button x:Name="ScanOnceButton" Command="{Binding ScanOnceCommand}" 
                                    Grid.Column="0" Grid.Row="0" Style="{StaticResource myButtonStyle}" Height="50" Width="50" Margin="5,0">
                <Button.Effect>
                    <DropShadowEffect/>
                </Button.Effect>
                <Image Source="Resources\VirusScan.png" />
                <Button.ToolTip>Einmal Scannen</Button.ToolTip>
            </Button>
            <Button x:Name="MultiScanOnceButton" Command="{Binding MultiScanOnceCommand}" 
                                    Grid.Column="0" Grid.Row="0" Style="{StaticResource myButtonStyle}" Height="50" Width="50" Margin="5,5,5,0">
                <Button.Effect>
                    <DropShadowEffect/>
                </Button.Effect>
                <Image Source="Resources\Scan64x64.png" />
                <Button.ToolTip>Einmal multiple Flächen Scannen</Button.ToolTip>
            </Button>
            <Label Content="Thresh.:" />
            <TextBox x:Name="ThresholdTextBox" Text="{Binding Threshold, StringFormat=N3}" ToolTip="Max Entfernung in Meter" Margin="2,0"/>

            <Label Content="Propab.:" />
            <TextBox x:Name="ProbabilityTextBox" Text="{Binding Probability, StringFormat=N2 }" ToolTip="W.Keit 0.9 bis 0.99" Margin="2,0"/>

            <Label Content="Kacheln.:" Padding="5,5,5,0" />
            <Label Content="Zln x Splt" Padding="5,0,5,5" />
            <StackPanel Orientation="Horizontal">
                <TextBox x:Name="RowsTextBox" Text="{Binding Rows, StringFormat=D }" ToolTip="Zeilen: Anzahl vertikaler Unterteilungen der Pkt.Wolke" Margin="2,0" Width="20" />
                <Label Content="x" Padding="1,0,1,0" />
                <TextBox x:Name="ColsTextBox" Text="{Binding Columns, StringFormat=D }" ToolTip="Spalten: Anzahl horizontaler Unterteilungen der Pkt.Wolke" Margin="2,0" Width="20"/>
            </StackPanel>
            
            <Button x:Name="CamResetButton" Content="Reset Cam" Margin="2,10,2,0" Click="CamResetButton_Click"></Button>
        </StackPanel>
        <Grid Grid.Row="1" Grid.ColumnSpan="2" Background="Gray">
            <Label Content="{Binding State}" HorizontalAlignment="Right" Margin="0,0,5,0" />
        </Grid>
        
        <!-- The HelixViewport3D supports camera manipulation, and can be used just like the Viewport3D (aus Windows Media3D) -->
        <HelixToolkit:HelixViewport3D x:Name="Viewport" Grid.Column="1">
            <!-- Adding Camera with 
                 * Position = Point, where camera is located
                 * LookDirection = vector in which direction you want to face
                 * UpDirection = vector that tells the camera which way is up. If diddn't exist, the camera would spin uncontrollably -->
            <HelixToolkit:HelixViewport3D.Camera>
                <PerspectiveCamera x:Name="Camera" Position="0.25,-2.0,0.6" LookDirection="-1.4,1,-0.2" UpDirection="0,0,1" FieldOfView="75" />
            </HelixToolkit:HelixViewport3D.Camera>

            <!-- Remember to add light to the scene 
                 Höhenwinkel: 0° (Standard: 60°, 0°=Horizont, 90°=senkrecht)
                 Horizontalwinkel: 180° (Standard: 130°, 0°=vorne, 90°=links)-->
            <HelixToolkit:SunLight x:Name="Sun" Altitude="0.0" Azimuth="180"/>
            <HelixToolkit:GridLinesVisual3D Width="10" Length="10" MinorDistance="1" MajorDistance="4" Thickness="0.001" Fill="White"/>

            <!-- The content of this visual is defined in MainWindowVM.cs -->
            <ModelVisual3D Content="{Binding Model3D}"/>

        </HelixToolkit:HelixViewport3D>
        <StackPanel Orientation="Vertical" Grid.Column="1" Margin="10,10,0,0">
            <StackPanel.Resources>
                <!-- Note: Designer says: "... does not exist". That is a designer-bug! -->
                <!-- If you want the Designer to work, temporarily(!) change Project's platform target to Any CPU -->
                <!-- and reload the designer tab -->
                <local:Point3DToStringConverter x:Key="P3DConverter" />
                <local:Vector3DToStringConverter x:Key="V3DConverter" />
            </StackPanel.Resources>
            <StackPanel Orientation="Horizontal">
                <Label Content="CamPos.:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                <Label x:Name="CamPosLabel" Content="{Binding ElementName=Camera, Mode=OneWay, Path=Position, Converter={StaticResource P3DConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <Label Content="LookDir.:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                <Label x:Name="LookDirLabel" Content="{Binding ElementName=Camera, Mode=OneWay, Path=LookDirection, Converter={StaticResource V3DConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
            </StackPanel>
        </StackPanel>
        
    </Grid>
</Window>
